"""
权限管理序列化器
"""
from rest_framework import serializers
from django.contrib.auth.models import Permission, ContentType

class PermissionSerializer(serializers.ModelSerializer):
    """
    权限管理
    """
    class Meta:
        model = Permission
        fields = ['id', 'name', 'codename', 'content_type']

class ContentTypeSerializer(serializers.ModelSerializer):
    """
    新增时可选的权限类型
    """
    class Meta:
        model = ContentType
        fields = ['id', 'name']
